package com.xy;

import com.xy.action.Action;
import com.xy.action.Fail;
import com.xy.action.Success;
import com.xy.action.Wait;
import com.xy.spectator.Female;
import com.xy.spectator.Male;
import com.xy.spectator.Spectator;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/17 17:29
 * @description
 */
public class Client {
    public static void main(String[] args) {
        ObjectStructure successPersons = new ObjectStructure();
        ObjectStructure failPersons = new ObjectStructure();
        ObjectStructure waitPersons = new ObjectStructure();

        for (int i = 0; i < 20; i++) {
            Spectator spectator;
            if (i % 2 == 0) {
                spectator = new Male(i + "号 ","男");
            } else {
                spectator = new Female(i + "号 ","女");
            }
            if (i % 3 == 0) {
                successPersons.attach(spectator);
            } else if (i % 3 == 1) {
                failPersons.attach(spectator);
            } else {
                waitPersons.attach(spectator);
            }
        }
        Action success = new Success();
        Action fail = new Fail();
        Action wait = new Wait();

        System.out.println("-----success-----");
        successPersons.display(success);
        System.out.println("------fail------");
        failPersons.display(fail);
        System.out.println("------wait-------");
        waitPersons.display(wait);
    }
}
